package com.ruoyi.app.controller;

import com.ruoyi.app.service.CchTestService;
import com.ruoyi.common.core.domain.AjaxResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * 描述:测试类
 *
 * @author chenconghua
 * @version 1.0
 * @create 2022-10-21 10:19 PM
 */
@RestController
@CrossOrigin
@RequestMapping("app/api/cchtest")
public class CchTestController {

    @Autowired
    private CchTestService cchTestService;


    /**
    * 描述: 测试方法1
    * @Param: Integer appId
    * @return:
    * @Author: chenconghua
    * @data: 10/31/22
    */
    @GetMapping("/test1")
    public AjaxResult test3(@RequestParam("appId") Integer appId){
        AjaxResult ajaxResult =AjaxResult.success();
        ajaxResult.put("appId","cch");
        return ajaxResult;
    }

    /**
    * 描述: 测试方法2
    * @Param: appId,name
    * @return:
    * @Author: chenconghua
    * @data: 10/31/22
    */
    @PostMapping("/test2")
    public AjaxResult test4(@RequestParam("appId") Integer appId,@RequestParam("name") String  name){

        if (appId==5) {
            return AjaxResult.success(cchTestService.list());

        }else
            return AjaxResult.error("登录失败");

    }

}

